package pojo.entity;

import com.alibaba.fastjson.annotation.JSONField;

import java.sql.Timestamp;

/**
 * 评论实体类
 */
public class Comment {
    private Long id; //评论id
    private Long goodId; //商品id
    private Long userId; //用户id
    private Integer userScore; //用户评分
    private String userContent; //用户评论
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Timestamp createTime; //创建时间
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Timestamp updateTime; //更新时间
    private Long parentId = 0L; //父级评论id(0代表无父类，-1代表该评论已逻辑删除)
    private User user; //用户信息

    public Comment() {
    }

    public Comment(Long id, Long goodId, Long userId,
                   Integer userScore, String userContent,
                   Timestamp createTime, Timestamp updateTime,
                   Long parentId) {
        this.id = id;
        this.goodId = goodId;
        this.userId = userId;
        this.userScore = userScore;
        this.userContent = userContent;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.parentId = parentId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getGoodId() {
        return goodId;
    }

    public void setGoodId(Long goodId) {
        this.goodId = goodId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Integer getUserScore() {
        return userScore;
    }

    public void setUserScore(Integer userScore) {
        this.userScore = userScore;
    }

    public String getUserContent() {
        return userContent;
    }

    public void setUserContent(String userContent) {
        this.userContent = userContent;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public String toString() {
        return "Comment{" +
                "id=" + id +
                ", goodId=" + goodId +
                ", userId=" + userId +
                ", userScore=" + userScore +
                ", userContent='" + userContent + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", parentId=" + parentId +
                ", user=" + user +
                '}';
    }
}
